/*
   Copyright (c) [2023] [魔凤啸天]
   [MFUI] is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2. 
   You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2 
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
   See the Mulan PSL v2 for more details.  
*/
#include "drawnode.hpp"

namespace MFUI{
    DrawNode::~DrawNode(){}
	SetColor::~SetColor(){}
	void SetColor::draw(Renderer* r){
		r->setdrawcolor(color);
	}
	SetColor::SetColor(SDL_Color c):color(c){}
	DrawPoint::~DrawPoint(){}
	void DrawPoint::draw(Renderer* r){
		r->drawpoint(p.x,p.y);
	}
	DrawPoint::DrawPoint(SDL_Point& p):p(p){}
	DrawLine::~DrawLine(){}
	void DrawLine::draw(Renderer* r){
		r->drawline(x.x,x.y,y.x,y.y);
	}
	DrawLine::DrawLine(SDL_Point& x,SDL_Point& y):x(x),y(y){}
	DrawRect::~DrawRect(){}
	void DrawRect::draw(Renderer* r){
		r->drawrect(&rect);
	}
	DrawRect::DrawRect(SDL_Rect& r):rect(r){}
	FillRect::~FillRect(){}
	void FillRect::draw(Renderer* r){
		r->fillrect(&rect);
	}
	FillRect::FillRect(SDL_Rect& r):rect(r){}
	DrawTexture::~DrawTexture(){}
	void DrawTexture::draw(Renderer* r){
		SDL_SetTextureAlphaMod(texture,alpha);
		r->copy(texture,&src,&dst);
	}
	DrawTexture::DrawTexture(SDL_Texture* t,SDL_Rect& src,SDL_Rect& dst,Uint8 a):
	texture(t),src(src),dst(dst),alpha(a){}
	DrawTextureEx::~DrawTextureEx(){}
	void DrawTextureEx::draw(Renderer* r){
		SDL_SetTextureAlphaMod(texture,alpha);
		r->copyEx(texture,&src,&dst,angle,&center,flip);
	}
	DrawTextureEx::DrawTextureEx(SDL_Texture* t,SDL_Rect& src,SDL_Rect& dst,
	SDL_RendererFlip f,double& degree,SDL_Point& center,Uint8 a):DrawTexture(t,src,
	dst,a),flip(f),angle(degree),center(center){}
	DrawFPoint::~DrawFPoint(){}
	void DrawFPoint::draw(Renderer* r){
		r->drawpointF(p.x,p.y);
	}
	DrawFPoint::DrawFPoint(SDL_FPoint& p):p(p){}
	DrawFLine::~DrawFLine(){}
	void DrawFLine::draw(Renderer* r){
		r->drawlineF(x.x,x.y,y.x,y.y);
	}
	DrawFLine::DrawFLine(SDL_FPoint& x,SDL_FPoint& y):x(x),y(y){}
	DrawFRect::~DrawFRect(){}
	void DrawFRect::draw(Renderer* r){
		r->drawrectF(&rect);
	}
	DrawFRect::DrawFRect(SDL_FRect& r):rect(r){}
	FillFRect::~FillFRect(){}
	void FillFRect::draw(Renderer* r){
		r->fillrectF(&rect);
	}
	FillFRect::FillFRect(SDL_FRect& r):rect(r){}
	DrawFTexture::~DrawFTexture(){}
	void DrawFTexture::draw(Renderer* r){
		SDL_SetTextureAlphaMod(texture,alpha);
		r->copyF(texture,&src,&dst);
	}
	DrawFTexture::DrawFTexture(SDL_Texture* t,SDL_Rect& src,SDL_FRect& dst,Uint8 a):
	texture(t),src(src),dst(dst),alpha(a){}
	DrawFTextureEx::~DrawFTextureEx(){}
	void DrawFTextureEx::draw(Renderer* r){
		SDL_SetTextureAlphaMod(texture,alpha);
		r->copyExF(texture,&src,&dst,angle,&center,flip);
	}
	DrawFTextureEx::DrawFTextureEx(SDL_Texture* t,SDL_Rect& src,SDL_FRect& dst,
	SDL_RendererFlip f,double& degree,SDL_FPoint& center,Uint8 a):DrawFTexture(t,src,
	dst,a),flip(f),angle(degree),center(center){}
}